package lol.clann.bukkit.pluginboot.model.gui;

import org.bukkit.Material;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.inventory.ItemStack;

import java.util.function.Function;

/**
 * @author pyz
 * @date 2018/7/1 上午10:35
 */
public class Button extends Element<Button> {

    ItemStack icon = new ItemStack(Material.STONE);

    public Button() {
        setExtend(this);
        setIcon(b -> icon);
    }

    @Override
    public ItemStack getIcon() {
        return icon;
    }

    public Button setIcon(ItemStack icon) {
        this.icon = icon;
        setExtend(this);
        return this;
    }

    @Override
    public Button setIcon(Function<Button, ItemStack> icon) {
        super.setIcon(icon);
        return this;
    }

    @Override
    public Button setExtend(Button button) {
        super.setExtend(button);
        return this;
    }

    @Override
    public Button setClickAction(Function<ClickAction<InventoryClickEvent, Button>, Boolean> clickAction) {
        super.setClickAction(clickAction);
        return this;
    }

}
